package com.financialsharing.pojo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.BaseRowModel;
import lombok.Data;
import org.apache.ibatis.type.Alias;

import java.util.Date;

/**
 * @author lvyongwei
 *    不需要太正规，Transactional给一些登录注册什么的加上日志
 */
@Data
@Alias("operate")
public class Operate extends BaseRowModel {

    /**
     * 日志记录id
     */
    @ExcelProperty(index = 0,value = "日志记录id")
    private Integer operateId;

    /**
     * 操作类型
     */
    @ExcelProperty(index = 1,value = "操作类型")
    private String operateStyle;

    /**
     * 操作人员
     */
    @ExcelProperty(index = 2,value = "操作人员")
    private String operateUser;

    /**
     * 用户权限
     */
    @ExcelProperty(index = 3,value = "用户权限")
    private String operateRoot;

    /**
     * 操作状态
     */
    @ExcelProperty(index = 4,value = "操作状态")
    private String operateStatus;

    /**
     * 操作日期
     */
    @ExcelProperty(index = 5,value = "操作日期")
    private Date operateDate;

    /**
     * 操作详情
     */
    @ExcelProperty(index = 6,value = "操作详情")
    private String operateDetail;

    /**
     * 页码数
     */
    @ExcelIgnore
    private Integer pageNum;

    /**
     * 页码条数
     */
    @ExcelIgnore
    private Integer pageSize;

    public Operate() {
    }

    public Operate(String operateStyle, String operateUser, Integer operateRootId, String operateStatus, Date operateDate, String operateDetail) {
        this.operateStyle = operateStyle;
        this.operateUser = operateUser;
        switch (operateRootId){
            case 1:
                this.operateRoot = "管理员";
                break;
            case 2:
                this.operateRoot = "教师";
                break;
            case 3:
                this.operateRoot = "评审专家";
                break;
            case 4:
                this.operateRoot = "高校学生";
                break;
            case 5:
                this.operateRoot = "ilab平台用户";
                break;
            default:
                this.operateRoot = "高校学生";
        }
        this.operateStatus = operateStatus;
        this.operateDate = operateDate;
        this.operateDetail = operateDetail;
    }
}
